package com.redxiii.spike.util.message;

import java.util.Date;

import com.redxiii.spike.api.message.Message;

/**
 * @author Daniel Filgueiras
 * @since 19/06/2011
 */
public abstract class BaseMessage implements Message {

	private Date date;
	protected StringBuilder text;
	
	public BaseMessage(StringBuilder text) {
		this.text = text;
		this.date = new Date();
	}
	public BaseMessage(CharSequence text) {
		this(new StringBuilder(text));
	}
	
	public static BaseMessage getBaseMessage(CharSequence text) {
		return new BaseMessage(text) {};
	}
	
	@Override
	public Date getDate() {
		return date;
	}

	@Override
	public String toString() {
		return text.toString();
	}
	
	@Override
	public StringBuilder toText() {
		return text;
	}
}
